import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { DataService } from '../../services/data.service'
declare var $: any;
@Component({
  selector: 'app-header',
  templateUrl: './header.component.html',
  styleUrls: ['./header.component.scss']
})
export class HeaderComponent implements OnInit {
  @Input() current:number;
  // @Output() audio = new EventEmitter();

  public helptype:boolean;

  constructor(
    public data: DataService
  ) { }

  ngOnInit() {
    this.helptype= this.data.HelpType;
  }

  help() {
    this.helptype = !this.helptype;
  }

  StartPlay() {
    let $audio= $("audio").get(0);
    let $src= $("#src");
    console.log($audio)
    if($audio == undefined) return;
    // $audio.addEventListener("ended", function () {
    //   alert(123)
    // })
    if($audio.paused) {
      $audio.play();
      $src.attr("src", "./assets/images/header/voice.png");
    }else {
      $audio.pause();
      $src.attr("src", "./assets/images/header/voice_end.png");
    }
  }


  // 标题
  totalityTitle = {
    "1": "新宝骏RC6\RM5 新技术",
    "2": "车型配置特点",
    "3": "新宝骏RC6车型配置特点",
    "4": "新宝骏RC6车型配置特点",
    "5": "新宝骏RC6车型配置特点",
    "6": "新宝骏RC6车型配置特点",
    "7": "新宝骏RC6车型配置特点",
    "8": "新宝骏RC6车型配置特点",
    "9": "新宝骏RC6车型配置特点",
    "10": "新宝骏RC6车型配置特点",
    "11": "新宝骏RC6车型配置特点",
    "12": "新宝骏RC6车型配置特点",
    "13": "新宝骏RC6车型配置特点",
    "14": "新宝骏RC6车型配置特点",
    "15": "新宝骏RM5车型配置特点",
    "16": "新宝骏RM5车型配置特点",
    "17": "新宝骏RM5车型配置特点",
    "18": "新宝骏RM5车型配置特点",
    "19": "新宝骏RM5车型配置特点",
    "20": "新宝骏RM5车型配置特点",
    "21": "新宝骏RM5车型配置特点",
    "22": "新宝骏RM5车型配置特点",
    "23": "新宝骏RM5车型配置特点",
    "24": "间接式胎压监测系统（iTPMS）", 
    "25": "间接式胎压监测系统（iTPMS）",
    "26": "间接式胎压监测系统（iTPMS）",
    "27": "间接式胎压监测系统（iTPMS）",
    "28": "车载无线充电",
    "29": "车载无线充电",
    "30": "车载无线充电",
    "31": "车载无线充电",
    "32": "博泰车联网系统概述",
    "33": "博泰车联网系统概述",
    "34": "博泰车联网系统概述",
    "35": "博泰车联网系统概述",
    "36": "博泰车联网系统概述",
    "37": "博泰车联网系统概述",
    "38": "智能钥匙（手机）",
    "39": "智能钥匙（手机）",
    "40": "智能钥匙（手机）",
  };
}
